/*
 * 文件名称: Constants.java Copyright 2011-2016 Ximalaya All right reserved.
 */
package top.zxybird.yun.common;

/**
 * @author Ted Wang
 */
public class Constants {
  public static final String VERSION = "3.0.0-M2";
  public static final String ROOT = ""; // 需要兼容新的NAMESPACE和2.x版本的NAMESPACE
  public static final String OLD_NAMESPACE = "mainstay-2.0";
  public static final String NAMESPACE = "mainstay";
  public static final String COLON = ":";
  public static final String COMMA = ",";
  public static final String SHARP = "#";
  public static final String UNDER_LINE = "_";
  public static final String PATH_SEPERATOR = "/";
  public static final String QUESTION_MARK = "?";
  public static final String EQ = "=";
  public static final String AND = "&";
  public static final String ROLE = "role";
  public static final String PROVIDER = "provider";
  public static final String CONSUMER = "consumer";
  public static final String QUEUE = "queue";
  public static final String GROUP = "group";
  public static final String HOST = "host";
  public static final String PORT = "port";
  public static final String IP = "ip";
  public static final String PROTOCOL = "protocol";
  public static final String THRIFT = "thrift";
  public static final String TRANSPORT = "transport";

  public static final byte FLAG_REQUEST = 0x00;
  public static final byte FLAG_RESPONSE = 0x01;

  // 注意 0x21 根据message变化而变化，magic 仅为第一位
  public static final byte[] ORIGIN_COMPACT_THRIFT_MAGIC = new byte[] { (byte) 0x82, (byte) 0x21 };
  public static final byte[] ORIGIN_BINARY_THRIFT_MAGIC = new byte[] { (byte) 0x80, (byte) 0x01 };
  public static final byte[] MAINSTAY_3_MAGIC = new byte[] { (byte) 0xa2, (byte) 0x01 };
  public static final byte[] MAINSTAY_3_HEARTBEAT_MAGIC = new byte[] { (byte) 0xc2, (byte) 0x01 };
  public static final byte[] EMPTY_RESERVED_BYTES = new byte[] { (byte) 0x00, (byte) 0x00 };

  public enum MessageType {
    originCompactThrift, originBinaryThrift, Mainstay3, Mainstay3HeartBeat, unknown
  }
}
